package com.zyw.module.console.sys.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.zyw.module.console.sys.po.Menu;

import java.util.LinkedList;
import java.util.List;

/**
 * @author zhangyw
 * @date 2017/3/16 15:35
 */
public class MenuTreeVo {

    private int id;

    private int pid;

    private String title;

    private String icon;

    private String url;

    private String target;

    private boolean hasChilds;

    private List<MenuTreeVo> subs;

    public MenuTreeVo() {
    }

    public MenuTreeVo(Menu root) {
        this.id = root.getId();
        this.pid = root.getPid();
        this.title = root.getTitle();
        this.icon = root.getIcon();
        this.url = root.getUrl();
        this.target = root.getTarget();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @JSONField(serialize = false)
    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public boolean isHasChilds() {
        return hasChilds;
    }

    public void setHasChilds(boolean hasChilds) {
        this.hasChilds = hasChilds;
    }

    public List<MenuTreeVo> getSubs() {
        return subs;
    }

    public void setSubs(List<MenuTreeVo> subs) {
        this.subs = subs;
    }

    public void addSubs(MenuTreeVo sub) {
        if (this.subs == null)
            this.subs = new LinkedList<MenuTreeVo>();

        this.subs.add(sub);
    }


}
